package com.skynet.supervision.utils;

import javax.validation.constraints.NotNull;
import java.util.Locale;
import java.util.UUID;

public class UuidUtils {

    /**
     * 生成UUID
     *
     * @return UUID String
     */
    public static @NotNull String randomUUID(boolean uppercase) {
        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
        return uppercase ? uuid.toUpperCase(Locale.ROOT) : uuid;
    }

    /**
     * 生成UUID
     *
     * @return UUID String
     */
    public static @NotNull String randomUUID() {
        return randomUUID(false);
    }
}
